package com.kgc.cgprovider.controller;

import com.kgc.basic.util.ResponseMsg;
import com.kgc.cgapi.service.PurchaseInvoiceRemote;
import com.kgc.cgprovider.service.PurchaseInvoiceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class PurchaseInvoiceController implements PurchaseInvoiceRemote {
    private Logger logger = LoggerFactory.getLogger(PurchaseInvoiceController.class);

    @Autowired
    private PurchaseInvoiceService purchaseInvoiceService;

    @Override
    public ResponseMsg selectPurchaseInvoiceByPage(Map<String, Object> map) {
        logger.info("PurchaseInvoiceController selectPurchaseInvoiceByPage map:{}", map);
        ResponseMsg msg = purchaseInvoiceService.selectPurchaseInvoiceByPage(map);
        logger.debug("PurchaseInvoiceController selectPurchaseInvoiceByPage msg:{}", msg);
        return msg;
    }

    @Override
    public ResponseMsg insertPurchaseInvoice(Map<String, Object> map) {
        logger.info("PurchaseInvoiceController insertPurchaseInvoice map:{}", map);
        ResponseMsg msg = purchaseInvoiceService.insertPurchaseInvoice(map);
        logger.debug("PurchaseInvoiceController insertPurchaseInvoice msg:{}", msg);
        return msg;
    }

    @Override
    public ResponseMsg selectPurchaseInstoreByPid(int supplierId) {
        logger.info("PurchaseInvoiceController selectPurchaseInstoreByPid supplierId:{}", supplierId);
        ResponseMsg msg = purchaseInvoiceService.selectPurchaseInstoreByPid(supplierId);
        logger.debug("PurchaseInvoiceController selectPurchaseInstoreByPid msg:{}", msg);
        return msg;
    }

    @Override
    public ResponseMsg selectPurchaseInstoreDetailByInstoreCode(String instoreCode) {
        logger.info("PurchaseInvoiceController selectPurchaseInstoreDetailByInstoreCode instoreCode:{}", instoreCode);
        ResponseMsg msg = purchaseInvoiceService.selectPurchaseInstoreDetailByInstoreCode(instoreCode);
        logger.debug("PurchaseInvoiceController selectPurchaseInstoreDetailByInstoreCode msg:{}", msg);
        return msg;
    }

    @Override
    public ResponseMsg selectPurchaseInvoiceByCode(String code) {
        logger.info("PurchaseInvoiceController selectPurchaseInvoiceByCode code:{}", code);
        ResponseMsg msg = purchaseInvoiceService.selectPurchaseInvoiceByCode(code);
        logger.debug("PurchaseInvoiceController selectPurchaseInvoiceByCode msg:{}", msg);
        return msg;
    }

    @Override
    public ResponseMsg selectPurchaseInvoiceDetailByCode(String invoiceCode) {
        logger.info("PurchaseInvoiceController selectPurchaseInvoiceDetailByCode invoiceCode:{}", invoiceCode);
        ResponseMsg msg = purchaseInvoiceService.selectPurchaseInvoiceDetailByCode(invoiceCode);
        logger.debug("PurchaseInvoiceController selectPurchaseInvoiceDetailByCode msg:{}", msg);
        return msg;
    }

    @Override
    public ResponseMsg deletePurchaseInvoice(int id) {
        logger.info("PurchaseInvoiceController deletePurchaseInvoice id:{}", id);
        ResponseMsg msg = purchaseInvoiceService.deletePurchaseInvoice(id);
        logger.debug("PurchaseInvoiceController deletePurchaseInvoice msg:{}", msg);
        return msg;
    }

    @Override
    public ResponseMsg deletePurchaseInvoiceByCode(String code) {
        logger.info("PurchaseInvoiceController deletePurchaseInvoiceByCode code:{}", code);
        ResponseMsg msg = purchaseInvoiceService.deletePurchaseInvoiceByCode(code);
        logger.debug("PurchaseInvoiceController deletePurchaseInvoiceByCode msg:{}", msg);
        return msg;
    }

    @Override
    public ResponseMsg deletePurchaseInvoiceDetailByCode(String code) {
        logger.info("PurchaseInvoiceController deletePurchaseInvoiceDetailByCode code:{}", code);
        ResponseMsg msg = purchaseInvoiceService.deletePurchaseInvoiceDetailByCode(code);
        logger.debug("PurchaseInvoiceController deletePurchaseInvoiceDetailByCode msg:{}", msg);
        return msg;
    }
}
